﻿@model PNProject.Core.FeedbackModel
@{
    ViewBag.Title = "Reply";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
}

<div class="admin_head">
Nội dung phản hồi _ @Model.Email
</div>

<script src="/Scripts/jquery-1.5.1.js" type="text/javascript"></script>
<div class="admin_content">


@using (Html.BeginForm("Reply", "AdminFeedback", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
        
        @Html.HiddenFor(a=>a.FeedbackID)
        @Html.HiddenFor(a=>a.Message)
        @Html.HiddenFor(a => a.ReplyMessage)
        @Html.HiddenFor(a => a.Lang)
        <div style="text-align:right;">
        @Model.SentDate
        </div>
        <br />
        <select id="select_lang">
            <option value="0">Tiếng Việt</option>
            <option value="1">Tiếng Anh</option>
            </select>
            <br />
        <br />
        <div class="title">
            Họ và tên<span style="color:Red;">(*)</span>:
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
        </div>
        <div class="title">
            Địa chỉ:
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
        </div>
        <div class="title">
                Số điện thoại:
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Phone)
            </div>
        <div class="title">
                Quốc gia:
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Country)
            </div>
    <div class="title">
                Tỉnh thành:
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Province)
            </div>
        <div class="title">
            Email<span style="color:Red;">(*)</span>:
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Email)
        </div>
        <div class="title">
            Tiêu đề<span style="color:Red;">(*)</span>:
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Title)
        </div>
        <div class="title">
            Nội dung<span style="color:Red;">(*)</span>:
        </div>
        <div class="editor-field">
           <textarea id="feed_message"></textarea>
        </div>
        <hr />
    <h2>Trả lời</h2>
     <textarea class="ckeditor" id="editor1" rows="10" style="width:540px; height:300px; overflow-x:hidden;"></textarea>

        
        <p>
            <input id="feed-submit" type="submit" value="Gửi đi" />
        </p>
    
}
</div>
<script type="text/javascript">
    $(document).ready(function () {
        var lang = $("#Lang").val();
        if (lang == "True") {
            $("#select_lang").val("0");
        }
        else {
            $("#select_lang").val("1");
        }

        $("#feed_message").val($("#Message").val());

        $("#feed-submit").click(function () {
            var value1 = CKEDITOR.instances['editor1'].getData();
            $("#ReplyMessage").val(value1);

            var lang = $(select_lang).val();
            if (lang == "0") {
                $("#Lang").val("True");
            }
            else {
                $("#Lang").val("False");
            }
        })
    });
    function confirmAction() {
        var confirmed = confirm("Bạn thực sự muốn thưc hiện thao tách này???");
        return confirmed;
    }
    $(window).load(function () {
        CKEDITOR.instances['editor1'].setData($("#ReplyMessage").val());
    });

</script>
